<template>
  <div id="stateStep" class="stateStep">
    <div v-for="(item, index) in stateSteps" :key="index" class="area">
      <a
        :class="[activeState === item.pathName ? 'active' : '']"
        @click="changeState(item.pathName)"
      >
        <div class="linkText">{{ item.name }}</div>
      </a>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    stateSteps: {
      type: Array,
      required: true
    },
    // eslint-disable-next-line vue/require-prop-types
    activeState: {
      required: true
    }
  },
  methods: {
    changeState(name) {
      this.$emit('changeState', name);
    }
  }
};
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
.stateStep {
  display: flex;
  justify-content: space-around;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid $themeColor;
  .area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    > a {
      position: relative;
      display: inline-block;
      width: 60px;
      height: 60px;
      font-size: 12px;
      color: $themeColor;
      line-height: 48px;
      text-align: center;
      border-radius: 50%;
      border: 6px solid $themeColor;
      cursor: pointer;
      background: #f9f9f9;
      &:after {
        position: absolute;
        bottom: -21px;
        left: 50%;
        transform: translateX(-50%);
        content: '';
        width: 10px;
        height: 10px;
        border-radius: 100%;
        background: #fff;
        border: 2px solid $themeColor;
      }
      &.active {
        border-color: $themeColor;
        color: $themeColor;
        &:after {
          background: $themeColor;
          border: none;
        }
      }
      .linkText {
        display: flex;
        align-items: center;
        height: 48px;
        line-height: 11px;
        justify-content: center;
      }
    }
  }
}
</style>
